<template>
	<div>
		<!-- 头部 -->
		<Dhead>
			<div slot="islink" class="my_back fl" @click="$router.push({path:routt})"></div>
		</Dhead>
		<!-- 轮播 -->
		<Dswiper :dswiper="dswiper"></Dswiper>
		<!-- 商品信息 -->
		<Dgoods :info="details"></Dgoods>
		<!-- 10年保证 -->
		<Dpro></Dpro>
		<!-- 商品所有信息 -->
		<Dgnav :info="details"></Dgnav>
		<!-- 热卖商品 -->
		<Dhotgs></Dhotgs>
		<!-- 公司 -->
		<QueNav></QueNav>
		<!-- 底部 -->
		<Dbtm :info='details'></Dbtm>
	</div>
</template>

<script>
	import Dhead from '../../components/shopHead.vue'
	import Dswiper from './components/Detailswiper.vue'
	import Dgoods from './components/Dgoods.vue'
	import Dpro from './components/Dpromise.vue'
	import Dgnav from './components/Dgoodsnav.vue'
	import Dhotgs from './components/Dhotgoods.vue'
	import QueNav from '../../components/que_nav.vue'
	import Dbtm from './components/Dbtm.vue'
	export default{
		data(){
			return{
				details:[],
				dswiper:[],
				routt:''
			}
		},
		components:{
			Dswiper,Dhead,Dbtm,Dgoods,Dpro,Dhotgs,Dgnav,QueNav
		},
		beforeRouteEnter(to,from,next) {
			// console.log(from)
			// console.log(to)
			next(vm=>{
				//设置从哪个路由来的
				if(from.fullPath=="/"){
					vm.routt = from.fullPath
				}else{
					vm.routt = 'Cheack?id=0'
				}
			})
		},
	    async mounted() {
			let id = this.$route.query.id
			// console.log(id)
			let goodsinfo = await this.$http.get('/goods/details',{id})
			// console.log(goodsinfo)
			this.details=goodsinfo.data.data[0]
			this.dswiper=JSON.parse(goodsinfo.data.data[0].g_swiper)
		}
	}
</script>

<style scoped="scoped">
</style>
